<#-- 这个片段会被插入到主模板中 -->
<#function generateParameterValidation>
    <#local validationCode = ""/>
    <#list enterParameters as param>
        <#if param.required>
            // ${param.name}参数校验
            Objects.requireNonNull(${param.name}, "${param.name}不能为空");
        </#if>
        <#if param.description??>
            <#if param.description.min??>
                if (${param.name} != null && ${param.name}.length() < ${param.description.min}) {
                throw new IllegalArgumentException("${param.name}长度不能小于${param.description.min}");
                }
            </#if>
            <#if param.description.max??>
                if (${param.name} != null && ${param.name}.length() > ${param.description.max}) {
                throw new IllegalArgumentException("${param.name}长度不能大于${param.description.max}");
                }
            </#if>
            <#if param.description.pattern??>
                if (${param.name} != null && !${param.name}.matches("${param.description.pattern}")) {
                throw new IllegalArgumentException("${param.name}格式不符合要求");
                }
            </#if>
        </#if>
    </#list>
    <#return validationCode/>
</#function>
